package leetcode.offer_two_special.stack;

/**
 * @author mazouri
 * @create 2021-09-10 22:24
 */
public class _39_largestRectangleArea {
    /**
     * force
     * @param heights
     * @return
     */
    public int largestRectangleArea1(int[] heights) {
        int maxArea = 0;
        for (int i = 0; i < heights.length; i++) {
            int min = heights[i];
            for (int j = i; j < heights.length; j++) {
                min = Math.min(min, heights[j]);
                int area = min * (j - i + 1);
                maxArea = Math.max(maxArea,area);
            }
        }
        return maxArea;
    }
}
